import java.io.*;
import java.net.*;


public class ServerThread extends Thread {
	private Socket socket;

	public ServerThread(Socket socket) {
		this.socket = socket;
	}
	
	public void run() {
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
		
			String name = in.readLine();
			String address = socket.getInetAddress().getHostAddress();
			int port = socket.getPort();
			String resp = "Name: " + name + ", address: " + address + ", port: " + port;
			out.println(resp);
			System.out.println(resp);
		} catch (IOException e1) {
			// do nothing
		}
		
		try {
			socket.close();
		} catch (IOException e) {
			// do nothing
		}
	}
}
